﻿//==================================================================
// Copyright (C) 2011 深圳市中旭企业管理股份有限公司
// 文件名: CrmCustomerInfo.cs
// 作 者：代码自动生成
// 日 期：2012-4-17 18:02:22
// 描 述：
// 版 本：1.00
// 修改历史纪录
// 版 本  修改时间      修改人            修改内容
// 1.00             
//==================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Csla;
using lite;
using Csla.Validation;
using Csla.Data;
using System.Data.SqlClient;
using ZX.DAL;
using OpenExpressApp.ORM;

namespace ZX.CRM.Library
{
	/// <summary>
    /// 客户信息表
    /// </summary>
	[Serializable]
    [Table(Name="CrmCustomerInfo")]
    [ZX.DBModule.Table("CrmCustomerInfo","ID")]
	public class CrmCustomerInfo: ZX.DBModule.BaseEntity
	{
        
        #region Business Methods 业务方法
       
		/// <summary>
        /// ID主键
        /// </summary>
        private static PropertyInfo< Guid > IDProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("ID"));
        [DataObjectField(true, true)]
        [Column, PK]
        public Guid ID
        {
            get { return GetProperty(IDProperty); }
            set { SetProperty(IDProperty, value); }
        }
        
		/// <summary>
        /// 客户编码
        /// </summary>
        private static PropertyInfo< string > CodeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Code"));
        [Column]
        public string Code
        {
            get { return GetProperty(CodeProperty); }
            set { SetProperty(CodeProperty, value); }
        }
		/// <summary>
        /// 国家ID
        /// </summary>
        private static PropertyInfo< string > StateProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("State"));
        [Column]
        public string State
        {
            get { return GetProperty(StateProperty); }
            set { SetProperty(StateProperty, value); }
        }
		/// <summary>
        ///  省份
        /// </summary>
        private static PropertyInfo< string > ProvinceProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Province"));
        [Column]
        public string Province
        {
            get { return GetProperty(ProvinceProperty); }
            set { SetProperty(ProvinceProperty, value); }
        }
		/// <summary>
        /// 市
        /// </summary>
        private static PropertyInfo< string > CityProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("City"));
        [Column]
        public string City
        {
            get { return GetProperty(CityProperty); }
            set { SetProperty(CityProperty, value); }
        }
		/// <summary>
        /// 区/县
        /// </summary>
        private static PropertyInfo< string > AreaProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Area"));
        [Column]
        public string Area
        {
            get { return GetProperty(AreaProperty); }
            set { SetProperty(AreaProperty, value); }
        }
		/// <summary>
        /// 详细地址
        /// </summary>
        private static PropertyInfo< string > AddressProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Address"));
        [Column]
        public string Address
        {
            get { return GetProperty(AddressProperty); }
            set { SetProperty(AddressProperty, value); }
        }
		/// <summary>
        /// 客户名称
        /// </summary>
        private static PropertyInfo< string > CustomerNameProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CustomerName"));
        [Column]
        public string CustomerName
        {
            get { return GetProperty(CustomerNameProperty); }
            set { SetProperty(CustomerNameProperty, value); }
        }
		/// <summary>
        /// 助记码
        /// </summary>
        private static PropertyInfo< string > MnemonicCodeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("MnemonicCode"));
        [Column]
        public string MnemonicCode
        {
            get { return GetProperty(MnemonicCodeProperty); }
            set { SetProperty(MnemonicCodeProperty, value); }
        }
		/// <summary>
        /// 是否总部  (1:是  0:否)
        /// </summary>
        private static PropertyInfo< string > IsHQProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("IsHQ"));
        [Column]
        public string IsHQ
        {
            get { return GetProperty(IsHQProperty); }
            set { SetProperty(IsHQProperty, value); }
        }
		/// <summary>
        /// 客户级别Id
        /// </summary>
        private static PropertyInfo< Guid > LevelIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("LevelId"));
        [Column]
        public Guid LevelId
        {
            get { return GetProperty(LevelIdProperty); }
            set { SetProperty(LevelIdProperty, value); }
        }
		/// <summary>
        /// 客户来源Id
        /// </summary>
        private static PropertyInfo< Guid > OriginIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("OriginId"));
        [Column]
        public Guid OriginId
        {
            get { return GetProperty(OriginIdProperty); }
            set { SetProperty(OriginIdProperty, value); }
        }
		/// <summary>
        /// 客户类型Id
        /// </summary>
        private static PropertyInfo< Guid > TypeIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("TypeId"));
        [Column]
        public Guid TypeId
        {
            get { return GetProperty(TypeIdProperty); }
            set { SetProperty(TypeIdProperty, value); }
        }
		/// <summary>
        /// 客户区域Id
        /// </summary>
        private static PropertyInfo< Guid > AreaIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("AreaId"));
        [Column]
        public Guid AreaId
        {
            get { return GetProperty(AreaIdProperty); }
            set { SetProperty(AreaIdProperty, value); }
        }
		/// <summary>
        /// 行业ID
        /// </summary>
        private static PropertyInfo< Guid > TradeIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("TradeId"));
        [Column]
        public Guid TradeId
        {
            get { return GetProperty(TradeIdProperty); }
            set { SetProperty(TradeIdProperty, value); }
        }
		/// <summary>
        /// 产值ID
        /// </summary>
        private static PropertyInfo< Guid > ProductIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("ProductId"));
        [Column]
        public Guid ProductId
        {
            get { return GetProperty(ProductIdProperty); }
            set { SetProperty(ProductIdProperty, value); }
        }
		/// <summary>
        /// 人员规模ID
        /// </summary>
        private static PropertyInfo< Guid > PersonIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("PersonId"));
        [Column]
        public Guid PersonId
        {
            get { return GetProperty(PersonIdProperty); }
            set { SetProperty(PersonIdProperty, value); }
        }
		/// <summary>
        /// 行会ID
        /// </summary>
        private static PropertyInfo< string > UnionIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("UnionId"));
        [Column]
        public string UnionId
        {
            get { return GetProperty(UnionIdProperty); }
            set { SetProperty(UnionIdProperty, value); }
        }
		/// <summary>
        /// 公司性质ID
        /// </summary>
        private static PropertyInfo< Guid > PropertyIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("PropertyId"));
        [Column]
        public Guid PropertyId
        {
            get { return GetProperty(PropertyIdProperty); }
            set { SetProperty(PropertyIdProperty, value); }
        }
		/// <summary>
        /// 决策人姓名
        /// </summary>
        private static PropertyInfo< string > DecisionmakerProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Decisionmaker"));
        [Column]
        public string Decisionmaker
        {
            get { return GetProperty(DecisionmakerProperty); }
            set { SetProperty(DecisionmakerProperty, value); }
        }
		/// <summary>
        /// 决策人职务
        /// </summary>
        private static PropertyInfo< string > DecisionPositionProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionPosition"));
        [Column]
        public string DecisionPosition
        {
            get { return GetProperty(DecisionPositionProperty); }
            set { SetProperty(DecisionPositionProperty, value); }
        }
		/// <summary>
        /// 决策人手机
        /// </summary>
        private static PropertyInfo< string > DecisionTelProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionTel"));
        [Column]
        public string DecisionTel
        {
            get { return GetProperty(DecisionTelProperty); }
            set { SetProperty(DecisionTelProperty, value); }
        }
        /// <summary>
        /// 决策人手机2
        /// </summary>
        private static PropertyInfo<string> DecisionTel2Property = RegisterProperty(typeof(CrmCustomerInfo), new PropertyInfo<string>("DecisionTel2"));
        [Column]
        public string DecisionTel2
        {
            get { return GetProperty(DecisionTel2Property); }
            set { SetProperty(DecisionTel2Property, value); }
        }
		/// <summary>
        /// 决策人邮箱
        /// </summary>
        private static PropertyInfo< string > DecisionEmailProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionEmail"));
        [Column]
        public string DecisionEmail
        {
            get { return GetProperty(DecisionEmailProperty); }
            set { SetProperty(DecisionEmailProperty, value); }
        }
		/// <summary>
        /// 籍贯
        /// </summary>
        private static PropertyInfo< string > HomeplaceProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Homeplace"));
        [Column]
        public string Homeplace
        {
            get { return GetProperty(HomeplaceProperty); }
            set { SetProperty(HomeplaceProperty, value); }
        }
		/// <summary>
        /// 决策人生日类型   0：农历1：阳历
        /// </summary>
        private static PropertyInfo< string > BirthdayTypeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("BirthdayType"));
        [Column]
        public string BirthdayType
        {
            get { return GetProperty(BirthdayTypeProperty); }
            set { SetProperty(BirthdayTypeProperty, value); }
        }
		/// <summary>
        /// 决策人生日日期
        /// </summary>
        private static PropertyInfo< DateTime > DecisionBirthdayProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("DecisionBirthday"));
        [Column]
        public DateTime DecisionBirthday
        {
            get { return GetProperty(DecisionBirthdayProperty); }
            set { SetProperty(DecisionBirthdayProperty, value); }
        }
		/// <summary>
        /// 性格
        /// </summary>
        private static PropertyInfo< string > CharacterProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Character"));
        [Column]
        public string Character
        {
            get { return GetProperty(CharacterProperty); }
            set { SetProperty(CharacterProperty, value); }
        }
		/// <summary>
        /// 决策人学历
        /// </summary>
        private static PropertyInfo< string > SchoolScientifcProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("SchoolScientifc"));
        [Column]
        public string SchoolScientifc
        {
            get { return GetProperty(SchoolScientifcProperty); }
            set { SetProperty(SchoolScientifcProperty, value); }
        }
		/// <summary>
        /// 决策人爱好
        /// </summary>
        private static PropertyInfo< string > DecisionFancyProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionFancy"));
        [Column]
        public string DecisionFancy
        {
            get { return GetProperty(DecisionFancyProperty); }
            set { SetProperty(DecisionFancyProperty, value); }
        }
		/// <summary>
        /// 决策人性别
        /// </summary>
        private static PropertyInfo< string > DecisionSexProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionSex"));
        [Column]
        public string DecisionSex
        {
            get { return GetProperty(DecisionSexProperty); }
            set { SetProperty(DecisionSexProperty, value); }
        }
		/// <summary>
        /// 决策人信用度
        /// </summary>
        private static PropertyInfo< string > DecisionTickProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionTick"));
        [Column]
        public string DecisionTick
        {
            get { return GetProperty(DecisionTickProperty); }
            set { SetProperty(DecisionTickProperty, value); }
        }
		/// <summary>
        /// 决策人作息情况
        /// </summary>
        private static PropertyInfo< string > DecisionRestProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionRest"));
        [Column]
        public string DecisionRest
        {
            get { return GetProperty(DecisionRestProperty); }
            set { SetProperty(DecisionRestProperty, value); }
        }
		/// <summary>
        /// 决策人学习情况
        /// </summary>
        private static PropertyInfo< string > DecisionLearnProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionLearn"));
        [Column]
        public string DecisionLearn
        {
            get { return GetProperty(DecisionLearnProperty); }
            set { SetProperty(DecisionLearnProperty, value); }
        }
		/// <summary>
        /// 决策人感觉类型(视觉性、听觉型等)
        /// </summary>
        private static PropertyInfo< Guid > DecisionFeelTypeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("DecisionFeelType"));
        [Column]
        public Guid DecisionFeelType
        {
            get { return GetProperty(DecisionFeelTypeProperty); }
            set { SetProperty(DecisionFeelTypeProperty, value); }
        }
		/// <summary>
        /// 决策人决策类型(求同型、求异型等)
        /// </summary>
        private static PropertyInfo< Guid > DecisionTypeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("DecisionType"));
        [Column]
        public Guid DecisionType
        {
            get { return GetProperty(DecisionTypeProperty); }
            set { SetProperty(DecisionTypeProperty, value); }
        }
		/// <summary>
        /// 决策人购买类型(生存型、品质型等)
        /// </summary>
        private static PropertyInfo< Guid > DecisionBuyTypeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("DecisionBuyType"));
        [Column]
        public Guid DecisionBuyType
        {
            get { return GetProperty(DecisionBuyTypeProperty); }
            set { SetProperty(DecisionBuyTypeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > DecisionAttitudeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("DecisionAttitude"));
        [Column]
        public string DecisionAttitude
        {
            get { return GetProperty(DecisionAttitudeProperty); }
            set { SetProperty(DecisionAttitudeProperty, value); }
        }
		/// <summary>
        /// 决策人荣誉
        /// </summary>
        private static PropertyInfo< string > CreditProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Credit"));
        [Column]
        public string Credit
        {
            get { return GetProperty(CreditProperty); }
            set { SetProperty(CreditProperty, value); }
        }
		/// <summary>
        /// 电话1
        /// </summary>
        private static PropertyInfo< string > Tel1Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Tel1"));
        [Column]
        public string Tel1
        {
            get { return GetProperty(Tel1Property); }
            set { SetProperty(Tel1Property, value); }
        }
		/// <summary>
        /// 电话2
        /// </summary>
        private static PropertyInfo< string > Tel2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Tel2"));
        [Column]
        public string Tel2
        {
            get { return GetProperty(Tel2Property); }
            set { SetProperty(Tel2Property, value); }
        }
		/// <summary>
        /// 邮编
        /// </summary>
        private static PropertyInfo< string > PostProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Post"));
        [Column]
        public string Post
        {
            get { return GetProperty(PostProperty); }
            set { SetProperty(PostProperty, value); }
        }
		/// <summary>
        /// 传真
        /// </summary>
        private static PropertyInfo< string > FaxProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Fax"));
        [Column]
        public string Fax
        {
            get { return GetProperty(FaxProperty); }
            set { SetProperty(FaxProperty, value); }
        }
		/// <summary>
        /// 企业邮箱
        /// </summary>
        private static PropertyInfo< string > EmailProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Email"));
        [Column]
        public string Email
        {
            get { return GetProperty(EmailProperty); }
            set { SetProperty(EmailProperty, value); }
        }
		/// <summary>
        /// 企业网站
        /// </summary>
        private static PropertyInfo< string > CompanyNettingProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CompanyNetting"));
        [Column]
        public string CompanyNetting
        {
            get { return GetProperty(CompanyNettingProperty); }
            set { SetProperty(CompanyNettingProperty, value); }
        }
		/// <summary>
        /// 企业成立日期
        /// </summary>
        private static PropertyInfo< DateTime > CompanyCreateDateProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("CompanyCreateDate"));
        [Column]
        public DateTime CompanyCreateDate
        {
            get { return GetProperty(CompanyCreateDateProperty); }
            set { SetProperty(CompanyCreateDateProperty, value); }
        }
		/// <summary>
        /// 公司产品
        /// </summary>
        private static PropertyInfo< string > CompanyProductProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CompanyProduct"));
        [Column]
        public string CompanyProduct
        {
            get { return GetProperty(CompanyProductProperty); }
            set { SetProperty(CompanyProductProperty, value); }
        }
		/// <summary>
        /// 客户关注
        /// </summary>
        private static PropertyInfo< string > CompanyAttentionProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CompanyAttention"));
        [Column]
        public string CompanyAttention
        {
            get { return GetProperty(CompanyAttentionProperty); }
            set { SetProperty(CompanyAttentionProperty, value); }
        }
		/// <summary>
        /// 公司利润
        /// </summary>
        private static PropertyInfo< string > CompanyGainProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CompanyGain"));
        [Column]
        public string CompanyGain
        {
            get { return GetProperty(CompanyGainProperty); }
            set { SetProperty(CompanyGainProperty, value); }
        }
		/// <summary>
        /// 今年员工数(准确值)(单位: 个)
        /// </summary>
        private static PropertyInfo< int > PersonSumProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("PersonSum"));
        [Column]
        public int PersonSum
        {
            get { return GetProperty(PersonSumProperty); }
            set { SetProperty(PersonSumProperty, value); }
        }
		/// <summary>
        /// 去年员工数(准确值)(单位: 个)
        /// </summary>
        private static PropertyInfo< int > PersonSum2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("PersonSum2"));
        [Column]
        public int PersonSum2
        {
            get { return GetProperty(PersonSum2Property); }
            set { SetProperty(PersonSum2Property, value); }
        }
		/// <summary>
        /// 前年员工数(准确值)(单位: 个)
        /// </summary>
        private static PropertyInfo< int > PersonSum3Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("PersonSum3"));
        [Column]
        public int PersonSum3
        {
            get { return GetProperty(PersonSum3Property); }
            set { SetProperty(PersonSum3Property, value); }
        }
		/// <summary>
        /// 今年产值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > ProductSumProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProductSum"));
        [Column]
        public decimal ProductSum
        {
            get { return GetProperty(ProductSumProperty); }
            set { SetProperty(ProductSumProperty, value); }
        }
		/// <summary>
        /// 去年产值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > ProductSum2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProductSum2"));
        [Column]
        public decimal ProductSum2
        {
            get { return GetProperty(ProductSum2Property); }
            set { SetProperty(ProductSum2Property, value); }
        }
		/// <summary>
        /// 前年产值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > ProductSum3Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProductSum3"));
        [Column]
        public decimal ProductSum3
        {
            get { return GetProperty(ProductSum3Property); }
            set { SetProperty(ProductSum3Property, value); }
        }
		/// <summary>
        /// 今年盈利值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > PayOffNum1Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("PayOffNum1"));
        [Column]
        public decimal PayOffNum1
        {
            get { return GetProperty(PayOffNum1Property); }
            set { SetProperty(PayOffNum1Property, value); }
        }
		/// <summary>
        /// 去年盈利值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > PayOffNum2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("PayOffNum2"));
        [Column]
        public decimal PayOffNum2
        {
            get { return GetProperty(PayOffNum2Property); }
            set { SetProperty(PayOffNum2Property, value); }
        }
		/// <summary>
        /// 前年盈利值(准确值)(单位:千万)
        /// </summary>
        private static PropertyInfo< decimal > PayOffNum3Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("PayOffNum3"));
        [Column]
        public decimal PayOffNum3
        {
            get { return GetProperty(PayOffNum3Property); }
            set { SetProperty(PayOffNum3Property, value); }
        }
		/// <summary>
        /// 今年毛利润
        /// </summary>
        private static PropertyInfo< decimal > ProfitNum1Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProfitNum1"));
        [Column]
        public decimal ProfitNum1
        {
            get { return GetProperty(ProfitNum1Property); }
            set { SetProperty(ProfitNum1Property, value); }
        }
		/// <summary>
        /// 去年毛利润
        /// </summary>
        private static PropertyInfo< decimal > ProfitNum2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProfitNum2"));
        [Column]
        public decimal ProfitNum2
        {
            get { return GetProperty(ProfitNum2Property); }
            set { SetProperty(ProfitNum2Property, value); }
        }
		/// <summary>
        /// 前年毛利润
        /// </summary>
        private static PropertyInfo< decimal > ProfitNum3Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("ProfitNum3"));
        [Column]
        public decimal ProfitNum3
        {
            get { return GetProperty(ProfitNum3Property); }
            set { SetProperty(ProfitNum3Property, value); }
        }
		/// <summary>
        /// 企业销售类型(内销，外销，内外销)
        /// </summary>
        private static PropertyInfo< Guid > CustomerSaleTyteProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("CustomerSaleTyte"));
        [Column]
        public Guid CustomerSaleTyte
        {
            get { return GetProperty(CustomerSaleTyteProperty); }
            set { SetProperty(CustomerSaleTyteProperty, value); }
        }
		/// <summary>
        /// 是否有培训部门(1:是  0:否)
        /// </summary>
        private static PropertyInfo< string > IsTrainDeptProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("IsTrainDept"));
        [Column]
        public string IsTrainDept
        {
            get { return GetProperty(IsTrainDeptProperty); }
            set { SetProperty(IsTrainDeptProperty, value); }
        }
		/// <summary>
        /// 主要竞争对手
        /// </summary>
        private static PropertyInfo< string > CompeterCustomerProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CompeterCustomer"));
        [Column]
        public string CompeterCustomer
        {
            get { return GetProperty(CompeterCustomerProperty); }
            set { SetProperty(CompeterCustomerProperty, value); }
        }
		/// <summary>
        /// 行业地位
        /// </summary>
        private static PropertyInfo< string > TradeDegreeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("TradeDegree"));
        [Column]
        public string TradeDegree
        {
            get { return GetProperty(TradeDegreeProperty); }
            set { SetProperty(TradeDegreeProperty, value); }
        }
		/// <summary>
        /// 公司愿景
        /// </summary>
        private static PropertyInfo< string > CustomerDreamProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CustomerDream"));
        [Column]
        public string CustomerDream
        {
            get { return GetProperty(CustomerDreamProperty); }
            set { SetProperty(CustomerDreamProperty, value); }
        }
		/// <summary>
        /// 决策层人数
        /// </summary>
        private static PropertyInfo< int > DecisionPersonsunProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("DecisionPersonsun"));
        [Column]
        public int DecisionPersonsun
        {
            get { return GetProperty(DecisionPersonsunProperty); }
            set { SetProperty(DecisionPersonsunProperty, value); }
        }
		/// <summary>
        /// 高层人数
        /// </summary>
        private static PropertyInfo< int > HighPersonsumProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("HighPersonsum"));
        [Column]
        public int HighPersonsum
        {
            get { return GetProperty(HighPersonsumProperty); }
            set { SetProperty(HighPersonsumProperty, value); }
        }
		/// <summary>
        /// 中层人数
        /// </summary>
        private static PropertyInfo< int > MiddlePersonsumProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("MiddlePersonsum"));
        [Column]
        public int MiddlePersonsum
        {
            get { return GetProperty(MiddlePersonsumProperty); }
            set { SetProperty(MiddlePersonsumProperty, value); }
        }
		/// <summary>
        /// 基层人数
        /// </summary>
        private static PropertyInfo< int > BelowPersonsumProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("BelowPersonsum"));
        [Column]
        public int BelowPersonsum
        {
            get { return GetProperty(BelowPersonsumProperty); }
            set { SetProperty(BelowPersonsumProperty, value); }
        }
		/// <summary>
        /// 合作过的培训公司
        /// </summary>
        private static PropertyInfo< string > TrainCompanyProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("TrainCompany"));
        [Column]
        public string TrainCompany
        {
            get { return GetProperty(TrainCompanyProperty); }
            set { SetProperty(TrainCompanyProperty, value); }
        }
		/// <summary>
        /// 培训时间
        /// </summary>
        private static PropertyInfo< DateTime > TrainDateProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("TrainDate"));
        [Column]
        public DateTime TrainDate
        {
            get { return GetProperty(TrainDateProperty); }
            set { SetProperty(TrainDateProperty, value); }
        }
		/// <summary>
        /// 对客户的承诺
        /// </summary>
        private static PropertyInfo< string > CustomerPromisProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CustomerPromis"));
        [Column]
        public string CustomerPromis
        {
            get { return GetProperty(CustomerPromisProperty); }
            set { SetProperty(CustomerPromisProperty, value); }
        }
		/// <summary>
        /// 影响决策的人
        /// </summary>
        private static PropertyInfo< string > AffectDecisionerProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("AffectDecisioner"));
        [Column]
        public string AffectDecisioner
        {
            get { return GetProperty(AffectDecisionerProperty); }
            set { SetProperty(AffectDecisionerProperty, value); }
        }
		/// <summary>
        /// 培训形式和内容
        /// </summary>
        private static PropertyInfo< string > TrainHistoryProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("TrainHistory"));
        [Column]
        public string TrainHistory
        {
            get { return GetProperty(TrainHistoryProperty); }
            set { SetProperty(TrainHistoryProperty, value); }
        }
		/// <summary>
        /// 企业痛苦点
        /// </summary>
        private static PropertyInfo< string > PainfulProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Painful"));
        [Column]
        public string Painful
        {
            get { return GetProperty(PainfulProperty); }
            set { SetProperty(PainfulProperty, value); }
        }
		/// <summary>
        /// 企业成长史
        /// </summary>
        private static PropertyInfo< string > PullulationProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Pullulation"));
        [Column]
        public string Pullulation
        {
            get { return GetProperty(PullulationProperty); }
            set { SetProperty(PullulationProperty, value); }
        }
		/// <summary>
        /// 企业发展史
        /// </summary>
        private static PropertyInfo< string > CustomerPhylogenyProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CustomerPhylogeny"));
        [Column]
        public string CustomerPhylogeny
        {
            get { return GetProperty(CustomerPhylogenyProperty); }
            set { SetProperty(CustomerPhylogenyProperty, value); }
        }
		/// <summary>
        /// 顾客见证
        /// </summary>
        private static PropertyInfo< string > CusTestimonyProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("CusTestimony"));
        [Column]
        public string CusTestimony
        {
            get { return GetProperty(CusTestimonyProperty); }
            set { SetProperty(CusTestimonyProperty, value); }
        }
		/// <summary>
        /// RAD指标ID
        /// </summary>
        private static PropertyInfo< Guid > RADTargetIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("RADTargetId"));
        [Column]
        public Guid RADTargetId
        {
            get { return GetProperty(RADTargetIdProperty); }
            set { SetProperty(RADTargetIdProperty, value); }
        }
		/// <summary>
        /// 企业培训预算
        /// </summary>
        private static PropertyInfo< decimal > CusTrainbudgetProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< decimal >("CusTrainbudget"));
        [Column]
        public decimal CusTrainbudget
        {
            get { return GetProperty(CusTrainbudgetProperty); }
            set { SetProperty(CusTrainbudgetProperty, value); }
        }
		/// <summary>
        /// 管理中遇到的问题
        /// </summary>
        private static PropertyInfo< string > ManagerQuestionProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("ManagerQuestion"));
        [Column]
        public string ManagerQuestion
        {
            get { return GetProperty(ManagerQuestionProperty); }
            set { SetProperty(ManagerQuestionProperty, value); }
        }
		/// <summary>
        /// 未来3-5年战略目标
        /// </summary>
        private static PropertyInfo< string > StrongPointProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("StrongPoint"));
        [Column]
        public string StrongPoint
        {
            get { return GetProperty(StrongPointProperty); }
            set { SetProperty(StrongPointProperty, value); }
        }
		/// <summary>
        /// 是否私海   1:是    0:否   2:下订单状态
        /// </summary>
        private static PropertyInfo< int > IsPrevateProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("IsPrevate"));
        [Column]
        public int IsPrevate
        {
            get { return GetProperty(IsPrevateProperty); }
            set { SetProperty(IsPrevateProperty, value); }
        }
		/// <summary>
        /// 联系人列表
        /// </summary>
        private static PropertyInfo< string > AttachListProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("AttachList"));
        [Column]
        public string AttachList
        {
            get { return GetProperty(AttachListProperty); }
            set { SetProperty(AttachListProperty, value); }
        }
		/// <summary>
        /// 是否可用   1:是    0:否
        /// </summary>
        private static PropertyInfo< int > IsValueProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("IsValue"));
        [Column]
        public int IsValue
        {
            get { return GetProperty(IsValueProperty); }
            set { SetProperty(IsValueProperty, value); }
        }
		/// <summary>
        /// 备注
        /// </summary>
        private static PropertyInfo< string > ExplainProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("Explain"));
        [Column]
        public string Explain
        {
            get { return GetProperty(ExplainProperty); }
            set { SetProperty(ExplainProperty, value); }
        }
		/// <summary>
        /// 销售顾问
        /// </summary>
        private static PropertyInfo< Guid > SaleadviserIdProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("SaleadviserId"));
        [Column]
        public Guid SaleadviserId
        {
            get { return GetProperty(SaleadviserIdProperty); }
            set { SetProperty(SaleadviserIdProperty, value); }
        }
		/// <summary>
        /// 顾问添加时间
        /// </summary>
        private static PropertyInfo< DateTime > SaleaddTimeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("SaleaddTime"));
        [Column]
        public DateTime SaleaddTime
        {
            get { return GetProperty(SaleaddTimeProperty); }
            set { SetProperty(SaleaddTimeProperty, value); }
        }
		/// <summary>
        /// 信息专员
        /// </summary>
        private static PropertyInfo< Guid > AddUserProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("AddUser"));
        [Column]
        public Guid AddUser
        {
            get { return GetProperty(AddUserProperty); }
            set { SetProperty(AddUserProperty, value); }
        }
		/// <summary>
        /// 添加时间
        /// </summary>
        private static PropertyInfo< DateTime > AddTimeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("AddTime"));
        [Column]
        public DateTime AddTime
        {
            get { return GetProperty(AddTimeProperty); }
            set { SetProperty(AddTimeProperty, value); }
        }

        /// <summary>
        /// 修改人
        /// </summary>
        private static PropertyInfo<Guid> ModifyUserProperty = RegisterProperty(typeof(CrmCustomerInfo), new PropertyInfo<Guid>("ModifyUser"));
        [Column]
        public Guid ModifyUser
        {
            get { return GetProperty(ModifyUserProperty); }
            set { SetProperty(ModifyUserProperty, value); }
        }
        /// <summary>
        /// 修改时间
        /// </summary>
        private static PropertyInfo<DateTime> ModifyTimeProperty = RegisterProperty(typeof(CrmCustomerInfo), new PropertyInfo<DateTime>("ModifyTime"));
        [Column]
        public DateTime ModifyTime
        {
            get { return GetProperty(ModifyTimeProperty); }
            set { SetProperty(ModifyTimeProperty, value); }
        }

		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< Guid > LectorUserProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("LectorUser"));
        [Column]
        public Guid LectorUser
        {
            get { return GetProperty(LectorUserProperty); }
            set { SetProperty(LectorUserProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > LectortimeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("Lectortime"));
        [Column]
        public DateTime Lectortime
        {
            get { return GetProperty(LectortimeProperty); }
            set { SetProperty(LectortimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< Guid > CustomeerMgrProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< Guid >("CustomeerMgr"));
        [Column]
        public Guid CustomeerMgr
        {
            get { return GetProperty(CustomeerMgrProperty); }
            set { SetProperty(CustomeerMgrProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > MgrtimeProperty = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< DateTime >("Mgrtime"));
        [Column]
        public DateTime Mgrtime
        {
            get { return GetProperty(MgrtimeProperty); }
            set { SetProperty(MgrtimeProperty, value); }
        }
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo<string> IsHistoryProperty = RegisterProperty(typeof(CrmCustomerInfo), new PropertyInfo<string>("IsHistory"));
        [Column]
        public string IsHistory
        {
            get { return GetProperty(IsHistoryProperty); }
            set { SetProperty(IsHistoryProperty, value); }
        }
		/// <summary>
        /// 备用1
        /// </summary>
        private static PropertyInfo< string > exp1Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("exp1"));
        [Column]
        public string exp1
        {
            get { return GetProperty(exp1Property); }
            set { SetProperty(exp1Property, value); }
        }
		/// <summary>
        /// 备用2
        /// </summary>
        private static PropertyInfo< string > exp2Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("exp2"));
        [Column]
        public string exp2
        {
            get { return GetProperty(exp2Property); }
            set { SetProperty(exp2Property, value); }
        }
		/// <summary>
        /// 备用3
        /// </summary>
        private static PropertyInfo< string > exp3Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("exp3"));
        [Column]
        public string exp3
        {
            get { return GetProperty(exp3Property); }
            set { SetProperty(exp3Property, value); }
        }
		/// <summary>
        /// 备用4
        /// </summary>
        private static PropertyInfo< string > exp4Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("exp4"));
        [Column]
        public string exp4
        {
            get { return GetProperty(exp4Property); }
            set { SetProperty(exp4Property, value); }
        }
		/// <summary>
        /// 备用5
        /// </summary>
        private static PropertyInfo< string > exp5Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< string >("exp5"));
        [Column]
        public string exp5
        {
            get { return GetProperty(exp5Property); }
            set { SetProperty(exp5Property, value); }
        }
		/// <summary>
        /// 备用6
        /// </summary>
        private static PropertyInfo< int > exp6Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("exp6"));
        [Column]
        public int exp6
        {
            get { return GetProperty(exp6Property); }
            set { SetProperty(exp6Property, value); }
        }
		/// <summary>
        /// 备用7
        /// </summary>
        private static PropertyInfo< int > exp7Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("exp7"));
        [Column]
        public int exp7
        {
            get { return GetProperty(exp7Property); }
            set { SetProperty(exp7Property, value); }
        }
		/// <summary>
        /// 备用8
        /// </summary>
        private static PropertyInfo< int > exp8Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("exp8"));
        [Column]
        public int exp8
        {
            get { return GetProperty(exp8Property); }
            set { SetProperty(exp8Property, value); }
        }
		/// <summary>
        /// 备用9
        /// </summary>
        private static PropertyInfo< int > exp9Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("exp9"));
        [Column]
        public int exp9
        {
            get { return GetProperty(exp9Property); }
            set { SetProperty(exp9Property, value); }
        }
		/// <summary>
        /// 备用10
        /// </summary>
        private static PropertyInfo< int > exp10Property = RegisterProperty(typeof(CrmCustomerInfo),new PropertyInfo< int >("exp10"));
        [Column]
        public int exp10
        {
            get { return GetProperty(exp10Property); }
            set { SetProperty(exp10Property, value); }
        }
		
        #endregion
        
        #region Validation Rules 验证规则
        //将验证规则与业务对象的属性联系在一起
        protected override void AddBusinessRules()
        {
            //AddRule的第一个参数是委托变量，也就是说是方法的变量
            ValidationRules.AddRule(CommonRules.StringRequired, "Code");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Code", 15));
            ValidationRules.AddRule(CommonRules.StringRequired, "State");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("State", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "Province");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Province", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "City");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("City", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Area");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Area", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Address");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Address", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerName");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerName", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "MnemonicCode");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("MnemonicCode", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "IsHQ");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("IsHQ", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "UnionId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("UnionId", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "Decisionmaker");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Decisionmaker", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionPosition");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionPosition", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionTel");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionTel", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionEmail");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionEmail", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "Homeplace");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Homeplace", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "BirthdayType");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("BirthdayType", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "Character");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Character", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "SchoolScientifc");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("SchoolScientifc", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionFancy");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionFancy", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionSex");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionSex", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionTick");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionTick", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionRest");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionRest", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionLearn");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionLearn", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "DecisionAttitude");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("DecisionAttitude", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "Credit");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Credit", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "Tel1");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Tel1", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Tel2");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Tel2", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Post");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Post", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Fax");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Fax", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "Email");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Email", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompanyNetting");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompanyNetting", 30));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompanyProduct");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompanyProduct", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompanyAttention");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompanyAttention", 100));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompanyGain");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompanyGain", 20));
            ValidationRules.AddRule(CommonRules.StringRequired, "IsTrainDept");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("IsTrainDept", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "CompeterCustomer");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CompeterCustomer", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "TradeDegree");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TradeDegree", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerDream");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerDream", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "TrainCompany");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TrainCompany", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerPromis");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerPromis", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "AffectDecisioner");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("AffectDecisioner", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "TrainHistory");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TrainHistory", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "Painful");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Painful", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "Pullulation");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Pullulation", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "CustomerPhylogeny");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CustomerPhylogeny", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "CusTestimony");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("CusTestimony", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "ManagerQuestion");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("ManagerQuestion", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "StrongPoint");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("StrongPoint", 200));
            ValidationRules.AddRule(CommonRules.StringRequired, "AttachList");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("AttachList", 1000));
            ValidationRules.AddRule(CommonRules.StringRequired, "Explain");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Explain", 500));
            ValidationRules.AddRule(CommonRules.StringRequired, "exp1");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("exp1", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "exp2");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("exp2", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "exp3");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("exp3", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "exp4");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("exp4", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "exp5");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("exp5", 50));
            //base.AddBusinessRules();
        }
        #endregion
        
        #region Factory Methods 工厂方法

        public CrmCustomerInfo(){}

        public static CrmCustomerInfo New()
        {
            return DataPortal.Create< CrmCustomerInfo>();
        }
        public static CrmCustomerInfo Get(Guid ID)
        {
            return DataPortal.Fetch< CrmCustomerInfo>(new SingleLazyCriteria< CrmCustomerInfo, Guid>(ID, false));
        }
        public static void Delete(Guid ID)
        {
            DataPortal.Delete(ID);
        }

        //public override CrmCustomerInfo Save()
        //{
            //return base.Save();
        //}
        #endregion
		
		#region Data Access 数据访问
        //由于DataPortal_create中没有对数据库的访问，所有标记了Runlocal特性，使得该方法只需在本地运行即可
        //如果代码中有访问数据库的方法，那么就不要用这个特性，使数据门户可以根据情况将此方法的运行选择在应用服务器还是本地
        [RunLocal()]
        protected override void DataPortal_Create()
        {
            //在此调用CheckRules对所有的属性进行验证规则的检查，这样检查只运行一次。
            ValidationRules.CheckRules();
        }


        //可以看到此方法没有标记任何特性
        //此方法要访问数据库所以不能标记本地，由于她没有任何数据库更新操作所以也无需事务性的保护
        //此方法调用结束后会隐含的调用MarkOld（）方法
        private void DataPortal_Fetch(Guid ID)
        {
            //通过连接字符串建立SQL连接对象，Using符号代表，范围释放的意思，SqlConnection对象会在此范围后被释放掉
             using (var ctx = ConnectionManager<SqlConnection>.GetManager(ConnectionStringNames))
            {
                IDb db = DbFactory.Instance.GetDb(ctx.Connection);
                IQuery q = db.Query();
                q.Constrain("ID").Equal(ID);
                var data = db.Select< CrmCustomerInfo>(q)[0];
                LoadProperty(IDProperty, data.ID);
                LoadProperty(CodeProperty, data.Code);
                LoadProperty(StateProperty, data.State);
                LoadProperty(ProvinceProperty, data.Province);
                LoadProperty(CityProperty, data.City);
                LoadProperty(AreaProperty, data.Area);
                LoadProperty(AddressProperty, data.Address);
                LoadProperty(CustomerNameProperty, data.CustomerName);
                LoadProperty(MnemonicCodeProperty, data.MnemonicCode);
                LoadProperty(IsHQProperty, data.IsHQ);
                LoadProperty(LevelIdProperty, data.LevelId);
                LoadProperty(OriginIdProperty, data.OriginId);
                LoadProperty(TypeIdProperty, data.TypeId);
                LoadProperty(AreaIdProperty, data.AreaId);
                LoadProperty(TradeIdProperty, data.TradeId);
                LoadProperty(ProductIdProperty, data.ProductId);
                LoadProperty(PersonIdProperty, data.PersonId);
                LoadProperty(UnionIdProperty, data.UnionId);
                LoadProperty(PropertyIdProperty, data.PropertyId);
                LoadProperty(DecisionmakerProperty, data.Decisionmaker);
                LoadProperty(DecisionPositionProperty, data.DecisionPosition);
                LoadProperty(DecisionTelProperty, data.DecisionTel);
                LoadProperty(DecisionTel2Property, data.DecisionTel2);
                LoadProperty(DecisionEmailProperty, data.DecisionEmail);
                LoadProperty(HomeplaceProperty, data.Homeplace);
                LoadProperty(BirthdayTypeProperty, data.BirthdayType);
                LoadProperty(DecisionBirthdayProperty, data.DecisionBirthday);
                LoadProperty(CharacterProperty, data.Character);
                LoadProperty(SchoolScientifcProperty, data.SchoolScientifc);
                LoadProperty(DecisionFancyProperty, data.DecisionFancy);
                LoadProperty(DecisionSexProperty, data.DecisionSex);
                LoadProperty(DecisionTickProperty, data.DecisionTick);
                LoadProperty(DecisionRestProperty, data.DecisionRest);
                LoadProperty(DecisionLearnProperty, data.DecisionLearn);
                LoadProperty(DecisionFeelTypeProperty, data.DecisionFeelType);
                LoadProperty(DecisionTypeProperty, data.DecisionType);
                LoadProperty(DecisionBuyTypeProperty, data.DecisionBuyType);
                LoadProperty(DecisionAttitudeProperty, data.DecisionAttitude);
                LoadProperty(CreditProperty, data.Credit);
                LoadProperty(Tel1Property, data.Tel1);
                LoadProperty(Tel2Property, data.Tel2);
                LoadProperty(PostProperty, data.Post);
                LoadProperty(FaxProperty, data.Fax);
                LoadProperty(EmailProperty, data.Email);
                LoadProperty(CompanyNettingProperty, data.CompanyNetting);
                LoadProperty(CompanyCreateDateProperty, data.CompanyCreateDate);
                LoadProperty(CompanyProductProperty, data.CompanyProduct);
                LoadProperty(CompanyAttentionProperty, data.CompanyAttention);
                LoadProperty(CompanyGainProperty, data.CompanyGain);
                LoadProperty(PersonSumProperty, data.PersonSum);
                LoadProperty(PersonSum2Property, data.PersonSum2);
                LoadProperty(PersonSum3Property, data.PersonSum3);
                LoadProperty(ProductSumProperty, data.ProductSum);
                LoadProperty(ProductSum2Property, data.ProductSum2);
                LoadProperty(ProductSum3Property, data.ProductSum3);
                LoadProperty(PayOffNum1Property, data.PayOffNum1);
                LoadProperty(PayOffNum2Property, data.PayOffNum2);
                LoadProperty(PayOffNum3Property, data.PayOffNum3);
                LoadProperty(ProfitNum1Property, data.ProfitNum1);
                LoadProperty(ProfitNum2Property, data.ProfitNum2);
                LoadProperty(ProfitNum3Property, data.ProfitNum3);
                LoadProperty(CustomerSaleTyteProperty, data.CustomerSaleTyte);
                LoadProperty(IsTrainDeptProperty, data.IsTrainDept);
                LoadProperty(CompeterCustomerProperty, data.CompeterCustomer);
                LoadProperty(TradeDegreeProperty, data.TradeDegree);
                LoadProperty(CustomerDreamProperty, data.CustomerDream);
                LoadProperty(DecisionPersonsunProperty, data.DecisionPersonsun);
                LoadProperty(HighPersonsumProperty, data.HighPersonsum);
                LoadProperty(MiddlePersonsumProperty, data.MiddlePersonsum);
                LoadProperty(BelowPersonsumProperty, data.BelowPersonsum);
                LoadProperty(TrainCompanyProperty, data.TrainCompany);
                LoadProperty(TrainDateProperty, data.TrainDate);
                LoadProperty(CustomerPromisProperty, data.CustomerPromis);
                LoadProperty(AffectDecisionerProperty, data.AffectDecisioner);
                LoadProperty(TrainHistoryProperty, data.TrainHistory);
                LoadProperty(PainfulProperty, data.Painful);
                LoadProperty(PullulationProperty, data.Pullulation);
                LoadProperty(CustomerPhylogenyProperty, data.CustomerPhylogeny);
                LoadProperty(CusTestimonyProperty, data.CusTestimony);
                LoadProperty(RADTargetIdProperty, data.RADTargetId);
                LoadProperty(CusTrainbudgetProperty, data.CusTrainbudget);
                LoadProperty(ManagerQuestionProperty, data.ManagerQuestion);
                LoadProperty(StrongPointProperty, data.StrongPoint);
                LoadProperty(IsPrevateProperty, data.IsPrevate);
                LoadProperty(AttachListProperty, data.AttachList);
                LoadProperty(IsValueProperty, data.IsValue);
                LoadProperty(ExplainProperty, data.Explain);
                LoadProperty(SaleadviserIdProperty, data.SaleadviserId);
                LoadProperty(SaleaddTimeProperty, data.SaleaddTime);
                LoadProperty(AddUserProperty, data.AddUser);
                LoadProperty(AddTimeProperty, data.AddTime);
                LoadProperty(LectorUserProperty, data.LectorUser);
                LoadProperty(LectortimeProperty, data.Lectortime);
                LoadProperty(CustomeerMgrProperty, data.CustomeerMgr);
                LoadProperty(MgrtimeProperty, data.Mgrtime);
                LoadProperty(IsHistoryProperty, data.IsHistory);
                LoadProperty(exp1Property, data.exp1);
                LoadProperty(exp2Property, data.exp2);
                LoadProperty(exp3Property, data.exp3);
                LoadProperty(exp4Property, data.exp4);
                LoadProperty(exp5Property, data.exp5);
                LoadProperty(exp6Property, data.exp6);
                LoadProperty(exp7Property, data.exp7);
                LoadProperty(exp8Property, data.exp8);
                LoadProperty(exp9Property, data.exp9);
                LoadProperty(exp10Property, data.exp10);
            }
        }

        [Transactional(TransactionalTypes.TransactionScope)]
        protected override void DataPortal_DeleteSelf()
        {
            //依然是调用下面的方法删除的，只是他此时可以获得自己的Id
            DataPortal_Delete(IDProperty);
        }
        #endregion

	}
}

